
let app = getApp();
Component({
  data: {
    tab: 1,
    show:false,
    selected: 0,
    color: "#AFAFAF",
    selectedColor: "#47A4FF",
    list: [{
      pagePath: "/pages/jiefang/jiefang",
      iconPath: "/asset/images/home.png",
      selectedIconPath: "/asset/images/home-active.png",
      text: "首页1"
    }, {
      pagePath: "/pages/mine/mine",
      iconPath: "/asset/images/mine.png",
      selectedIconPath: "/asset/images/mine-active.png",
      text: "我的1"
      }],
     list2: [{
       pagePath: "/pages/chengdong/chengdong",
       iconPath: "/asset/images/home.png",
       selectedIconPath: "/asset/images/home-active.png",
       text: "首页2"
     }, {
       pagePath: "/pages/mine/mine",
       iconPath: "/asset/images/mine.png",
       selectedIconPath: "/asset/images/mine-active.png",
       text: "我的2"
       }],
      list3: [{
        pagePath: "/pages/boao/boao",
        iconPath: "/asset/images/home.png",
        selectedIconPath: "/asset/images/home-active.png",
        text: "首页3"
      }, {
        pagePath: "/pages/mine/mine",
        iconPath: "/asset/images/mine.png",
        selectedIconPath: "/asset/images/mine-active.png",
        text: "我的3"
      }]
  },
  
  attached() {
    this.setData({
      tab:app.globalData.tab
    })
  },
   
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      console.log(data);
      const url = data.path
      wx.switchTab({
        url: url
      })
       this.setData({
         tab: app.globalData.tab
       })

    }
  }
})